package io.github.wanggit.antrpc.gateway.web.utils;

import java.util.HashMap;
import java.util.Map;

public abstract class ParameterUtil {

    public static Map<String, Object> queryStringToMap(String queryString) {
        if (null == queryString) {
            return new HashMap<>();
        }
        String[] tmps = queryString.split("&");
        Map<String, Object> parameters = new HashMap<>();
        for (String tmp : tmps) {
            String[] kv = tmp.split("=");
            parameters.put(kv[0], (kv.length == 2 ? kv[1] : null));
        }
        return parameters;
    }
}
